import java.util.HashMap;


class P11530_39643 {

    public static void main(String[] args) {
        int cases = Integer.parseInt(readLn());
       
       
        HashMap<Character, Integer> map = new HashMap<Character, Integer>();
       
        char[] c = new char[] {'a', 'd', 'g', 'j', 'm', 'p', 't', 'w', ' '};
       
        for (char car : c) {
            map.put(new Character(car), new Integer(1));
        }
       
        c = new char[] {'b', 'e', 'h', 'k', 'n', 'q', 'u', 'x'};
       
        for (char car : c) {
            map.put(new Character(car), new Integer(2));
        }
       
        c = new char[] {'c', 'f', 'i', 'l', 'o', 'r', 'v', 'y'};
       
        for (char car : c) {
            map.put(new Character(car), new Integer(3));
        }
       
        c = new char[] {'s', 'z' };
       
        for (char car : c) {
            map.put(new Character(car), new Integer(4));
        }
       
        for (int k = 0; k < cases; k++) {
           
           
            String line = readLn();
           
            int counter = 0;
            for (int m = 0; m < line.length(); m++) {
                counter += map.get(new Character(line.charAt(m)));
            }
           
            System.out.println("Case #" + (k + 1) +": " + counter);
           
        }
       
    }
   
    static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuilder buffer = new StringBuilder();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char) car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
                System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) {
            return (null);
        }
        if ((car < 0) && (buffer.length() == 0))
            return (null);
        return (buffer.toString());
    }
   
   
}